UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C1fUtOiK+jrKPYbwC7jJPnw7eT5inJBqWIuen3+qkNo='
WHERE
key_id = 'eb1d7db7ab7c99f336b8aea7c464c248c211ef73e9150e6960ea2cb20bbf0d03'
AND (
token = 'C1fUtOiK+jrKPYbwC7jJPnw7eT5inJBqWIuen3+qkNo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)