UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Di4giBo7wLNpWPYcscYSQp0AzkhC3oT+iGsL0os8+WI='
WHERE
key_id = 'b064850b0f9b72978e1da66df634a7f9bb5e59288ebb5c52952b289670fe5e41'
AND (
token = 'Di4giBo7wLNpWPYcscYSQp0AzkhC3oT+iGsL0os8+WI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)