UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SUSKJWu2kR2vgaa5CuNKxDGZN4nxCDmYo8T+hv5WpWo=' 
WHERE 
  key_id = '06407b7e084a3edbe4887157d91b620b876574c492dc07c867ae4f11c1729249' 
  AND (
    token = 'SUSKJWu2kR2vgaa5CuNKxDGZN4nxCDmYo8T+hv5WpWo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023