UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SnYLYzLYmt4HbiEe6kZ7PTgNKhotKRN2ewPTetA57BI=' 
WHERE 
  key_id = '9fbd4b88611f4d2719cabc24813419e479dcb440847af35829e485b4cd25d776' 
  AND (
    token = 'SnYLYzLYmt4HbiEe6kZ7PTgNKhotKRN2ewPTetA57BI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028