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