UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wjnPtyll962V6yD1zULLOqEwoW0ynkvzUjGsroTmKw0='
WHERE
key_id = '0d9d5d6a88ad4610170ca7890b6ad5774882cc84ee563a2d2937261a209df429'
AND (
token = 'wjnPtyll962V6yD1zULLOqEwoW0ynkvzUjGsroTmKw0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)