UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1d0COYRaFXY7W0F6tZtQfeBIrdDw39XNXhpCCmwdAgw='
WHERE
key_id = '7d4f43898d70332228c16aecc816d56b991df7db9da27f889d86969824b311b9'
AND (
token = '1d0COYRaFXY7W0F6tZtQfeBIrdDw39XNXhpCCmwdAgw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)