UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YRSGouKubffbtWvvKkoIY4D/1CHQrxH84K1aWZIn+Lg=' 
WHERE 
  key_id = '56867a04e9f32e064839365b35bf66eac61754a324f3cd9575cce36647eead36' 
  AND (
    token = 'YRSGouKubffbtWvvKkoIY4D/1CHQrxH84K1aWZIn+Lg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035