UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tsTSUzCZlNjElFWlGEHd+iphrNCuj0M0TyTTVCqshrM=' 
WHERE 
  key_id = 'fdf3229b7a5305a6a69bc2ccafc5e07522fc7e0c5c798a81b855dad84946939a' 
  AND (
    token = 'tsTSUzCZlNjElFWlGEHd+iphrNCuj0M0TyTTVCqshrM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032