UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4dY+J42vY5F1pCxOdc10t5MTZ3iLTBi70xsPuCJKmf0='
WHERE
key_id = '772c79d84869fee88bbcb7eb5aabf3e024abfac6ebaf24b8171553e860b240cb'
AND (
token = '4dY+J42vY5F1pCxOdc10t5MTZ3iLTBi70xsPuCJKmf0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)