UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O343rsLXFVwqoLUiW9by3e0JhmnyOOLbUj4aRYmhZnU='
WHERE
key_id = '362414c10320a49392007b22090a11398937efbcfb9c11d9a0c25c142c28fc2a'
AND (
token = 'O343rsLXFVwqoLUiW9by3e0JhmnyOOLbUj4aRYmhZnU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)