UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DvxU7g4n9rhyei2SuEqeZ0stfkr2aF71iA40A+rUoy0='
WHERE
key_id = '977988edb3bf16b9eadeebfd1b4eb5a85d97f582345040a3bff3c6c4993bb47e'
AND (
token = 'DvxU7g4n9rhyei2SuEqeZ0stfkr2aF71iA40A+rUoy0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)