UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5BaYALMhaXAipoLElr6C49AIY9rirOXMNL9y25RcQTg='
WHERE
key_id = 'ab5211990d4fb971dd8384c841eaec52124933c0fbc4e30f3a00e6fb23259b50'
AND (
token = '5BaYALMhaXAipoLElr6C49AIY9rirOXMNL9y25RcQTg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)