UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1XZ9v2m/7ehc45SPZdRwGVlFdBCqWXqR116xlcsaBnI='
WHERE
key_id = 'b524ec67cc59773969231bf19604c20c99491a29df30f655540a68f526a4af3b'
AND (
token = '1XZ9v2m/7ehc45SPZdRwGVlFdBCqWXqR116xlcsaBnI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)