UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CKE2W4aU6WIWAzM5pg85eAZt6mzzxe8fjnuCe+6ZvH8=' 
WHERE 
  key_id = '776d54fe7d6e101724148424684c1dde76558379e805eed09aec63ed811bec45' 
  AND (
    token = 'CKE2W4aU6WIWAzM5pg85eAZt6mzzxe8fjnuCe+6ZvH8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038