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