UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YzIU2aIWzjEFITYPypDBz+afMMXCd6TPYR1qDl6HcVc=' 
WHERE 
  key_id = 'b1122b93715d446cedc3825564a8ab27845a2be5fdc766ed126948bcc352326b' 
  AND (
    token = 'YzIU2aIWzjEFITYPypDBz+afMMXCd6TPYR1qDl6HcVc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031