UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KeUOcRfcSpAVX388REOi8wuuSQl+sVF7g50d4Dm8mzA='
WHERE
key_id = 'ec75a71e8a93ef3c73dec836b754fb4fd1387c9638581be84beb5c8e1029a4f7'
AND (
token = 'KeUOcRfcSpAVX388REOi8wuuSQl+sVF7g50d4Dm8mzA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)