UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QSd73u+mvVtQ1hnTr5PzJN18xqAoORhtxdCAX80YtTA='
WHERE
key_id = '4667e024f0b0f40b692dd8d7d3c839f6a6c1dfe8c483c754539f17de76b0084d'
AND (
token = 'QSd73u+mvVtQ1hnTr5PzJN18xqAoORhtxdCAX80YtTA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)