UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '88RvEuer43BR/2+D8JjhSUo7/pQeQ+C6+0JfSuT8hIk='
WHERE
key_id = 'ad522a78a0a01e31d21a598193862a57061f9665de804e42e66e0ff77e37226f'
AND (
token = '88RvEuer43BR/2+D8JjhSUo7/pQeQ+C6+0JfSuT8hIk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)