UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2Be8Smn6ZkKWPxIsSPtZjUinAmbr1pBJ0HCnAWhyU8k=' 
WHERE 
  key_id = '51a0bc842ba55f3ddb31a18e415df839e112bdf6e1f6cf1fc66f917ee75e75d2' 
  AND (
    token = '2Be8Smn6ZkKWPxIsSPtZjUinAmbr1pBJ0HCnAWhyU8k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036