UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cb1v3G1Lo9n222d6u9J0U5m6pjg+ZCNE1CcCCsqMKaQ=' 
WHERE 
  key_id = 'a3e4ef89ad8c4ddfbddb6092f86d1443f5744786225e672095e8a80ed96e7b48' 
  AND (
    token = 'Cb1v3G1Lo9n222d6u9J0U5m6pjg+ZCNE1CcCCsqMKaQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046