UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EdKY04n+gVcMe5fZ+iWO0cdhBSUX2IDOxoHt2AdrzGU=' 
WHERE 
  key_id = '0d351621e31e89a7d26fefe77a8f0c2312b139003d2365f3782f1fd2e35cd494' 
  AND (
    token = 'EdKY04n+gVcMe5fZ+iWO0cdhBSUX2IDOxoHt2AdrzGU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023