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