UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RWpKuFxZtaZqkXrBZ5M98hn/RdR81+lrsDz69eAJHvo=' 
WHERE 
  key_id = 'b1a1601aefda91039f40c0664f5c1adcb94e503b5d79dcb5e6a3b3bdff104d40' 
  AND (
    token = 'RWpKuFxZtaZqkXrBZ5M98hn/RdR81+lrsDz69eAJHvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035