UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pCSz7CDQDDt2ADdNhq6R0scV9f8dbzsGniOVfmlZnLg='
WHERE
key_id = 'd80fe807c1c032d90c0555e3c8e7ac672b535ab583dc85bd5b131704a2bb4d5c'
AND (
token = 'pCSz7CDQDDt2ADdNhq6R0scV9f8dbzsGniOVfmlZnLg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)