UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h2rIUDQhDSMF7ZL3QKafOhx5+jg+Yuo1+sumYT/7AG8='
WHERE
key_id = 'f0e714d13be7a465c5fe70747676df6703fc5faa12f141e39f3bee22f3e6a062'
AND (
token = 'h2rIUDQhDSMF7ZL3QKafOhx5+jg+Yuo1+sumYT/7AG8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)