UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BBnJxwcOE93vean0NP2YwiXX0WjMt26qMSUFNBX64nw=' 
WHERE 
  key_id = '1c5bf0940929898e330116fa2fb236b9112b803d05fdf50463cb5921ca48f804' 
  AND (
    token = 'BBnJxwcOE93vean0NP2YwiXX0WjMt26qMSUFNBX64nw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019