UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LCUOyHiBwdCWAsQQ1GMPe0kdcN+rb/qS7EPKjXBHdnM=' 
WHERE 
  key_id = '04fce426423b488b3140543320a402f51f1fcd77e7cbcefcc4fd5b9cb2fee6ed' 
  AND (
    token = 'LCUOyHiBwdCWAsQQ1GMPe0kdcN+rb/qS7EPKjXBHdnM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037