UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z4yzdm0lB2MSPzYOhG1ke+TB5Y6xTJVBxVv9NAsqDUo=' 
WHERE 
  key_id = 'dc90bb2b4d0403a9be744740bedf0daf70a400652b164c3c9b0811ec71bf99d4' 
  AND (
    token = 'z4yzdm0lB2MSPzYOhG1ke+TB5Y6xTJVBxVv9NAsqDUo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047