UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YL3a5ZC8WmQz91WZ1efJKupc2FBD/gWU4hxri3+GTWs='
WHERE
key_id = '4d5b3268b8a2f7b9657f9d3be8d9ec47f522db9e555bf73fb6f3c6b9e34e9591'
AND (
token = 'YL3a5ZC8WmQz91WZ1efJKupc2FBD/gWU4hxri3+GTWs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)