UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'abpPCmtFlp6uKrykTiPg0Pby12pOplBpRaLKxUpmqzs=' 
WHERE 
  key_id = '258b58011f25dc95a5e0d9e389f0d36b65d2d2452e8b33e332ee5d2c8dd72f9d' 
  AND (
    token = 'abpPCmtFlp6uKrykTiPg0Pby12pOplBpRaLKxUpmqzs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019