UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Kny1uKiARxSRT4fPC/sTCzYkMo9lHSlZWGu7KR6YRPA='
WHERE
key_id = 'f004c06c679946b179b186d0bd15d4d2484782956db51505773ed850c652bca0'
AND (
token = 'Kny1uKiARxSRT4fPC/sTCzYkMo9lHSlZWGu7KR6YRPA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)