UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wZC+mc96rcGRby3CSNt3Ik57Tro0glxOxNN78If3wcg='
WHERE
key_id = 'a702562394bc3e753cee876b1d3f9df553a8293cf44eeb81e39cf58f4b11d7ce'
AND (
token = 'wZC+mc96rcGRby3CSNt3Ik57Tro0glxOxNN78If3wcg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)