UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Xh2N/WR4FdaF+eAMWmUs77+cRlAqRJAUOnxfbRUjOGs='
WHERE
key_id = 'b74d0f6384b1da919506cf117e494dd5cb21e1651a6d4304a8c64ab6f6ed428f'
AND (
token = 'Xh2N/WR4FdaF+eAMWmUs77+cRlAqRJAUOnxfbRUjOGs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)