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