UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F+YOD5fqgabDGKrh06F0sTc+9BfVUhWhhaM1iu20ai4=' 
WHERE 
  key_id = '6d9cebc800c57e3446324c7943f51ede1da891c3c10d271a89980be1a33973c3' 
  AND (
    token = 'F+YOD5fqgabDGKrh06F0sTc+9BfVUhWhhaM1iu20ai4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047