UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0cE4ecErWC5z97inqP5rIGTMzI+0mQqLkRgt5q6VCaY=' 
WHERE 
  key_id = '85c1c151adfd1859d83c0220df5fdaa118b94ace9045ace5d1c57f2690715784' 
  AND (
    token = '0cE4ecErWC5z97inqP5rIGTMzI+0mQqLkRgt5q6VCaY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00014