UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BR8SJOTmsr5SjK5iWsBDFudPIPZFDs6Ap65WobgyP0A='
WHERE
key_id = '182be7337759822c6d555e6be11731ddbfdafa7b15e5a581cb10fc5b9ac7d9e5'
AND (
token = 'BR8SJOTmsr5SjK5iWsBDFudPIPZFDs6Ap65WobgyP0A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)