UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uLkEKz7uYrZpfvMl3ee5DcqfBcnFAHHugDQL6Py1m6c=' 
WHERE 
  key_id = '4f316c07956e72f24c2ee0340986062f3dc4c09fa5f1fe475c5259bced9b6dda' 
  AND (
    token = 'uLkEKz7uYrZpfvMl3ee5DcqfBcnFAHHugDQL6Py1m6c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038