UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8b+fQIB8hSJ8j6GCQ5fQmOy5ID8uNQaQejbQeVHhS18='
WHERE
key_id = '51de939fdde9d2560fd1d5f4668677ec8ac9dd0ab46928f2951baa576f40cabe'
AND (
token = '8b+fQIB8hSJ8j6GCQ5fQmOy5ID8uNQaQejbQeVHhS18='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)