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