UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w1D9g/Rv97AZec1SacRt+wXVFDNEBvsmKRLSzwpvmfQ=' 
WHERE 
  key_id = '800a22c5e146d1867cb22c89858ee3e275a3ce93008e11e2c8c7d7896da0d7d6' 
  AND (
    token = 'w1D9g/Rv97AZec1SacRt+wXVFDNEBvsmKRLSzwpvmfQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027