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