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