UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LAqMhIq5+hXd0JMcs+80CkEh+/nAtY3qBorjJplEE1c='
WHERE
key_id = 'd604ca01ef67836840670e3e3953e819fb78a2d46277f97c1927f95e4abbc5b5'
AND (
token = 'LAqMhIq5+hXd0JMcs+80CkEh+/nAtY3qBorjJplEE1c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)