UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PwklFT9t/c9N8dnoHJg7ewGwRNvlFxskqmzOxuLAWy8='
WHERE
key_id = 'e8391e3695921699151d6dcb77e415e07e37c52b3aaac5dc6ac16f592022bc07'
AND (
token = 'PwklFT9t/c9N8dnoHJg7ewGwRNvlFxskqmzOxuLAWy8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)