UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qkdxJ3MfTyqshnro9NsuktMiiATCGOUsJKa0J+Dwbb4=' 
WHERE 
  key_id = '5bf66a93c63d789cc04c09b7335de5389711527f13f97bc036ca1515d95d2c86' 
  AND (
    token = 'qkdxJ3MfTyqshnro9NsuktMiiATCGOUsJKa0J+Dwbb4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046