UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0HwQfU3INKT389yud0eaOiuvLt1Sv1gMWvybFlPRHII=' 
WHERE 
  key_id = 'bdee2135010abeef79bbd1f7afe253896577a877c66211a331d741ca7a650bdf' 
  AND (
    token = '0HwQfU3INKT389yud0eaOiuvLt1Sv1gMWvybFlPRHII=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017