UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1uATUWRQJbBGXApsDW6JJwqfCKwByT70SC+LwC2cx3I='
WHERE
key_id = '22a9ee08413de3e4014125f507981b7be7d31c2334acd3612b291c1fd02adeaf'
AND (
token = '1uATUWRQJbBGXApsDW6JJwqfCKwByT70SC+LwC2cx3I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)