UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R0giWrcgv2Rq4q8XdkztZ97wcFYqL+2zriEnx22/V9s='
WHERE
key_id = 'e137a2e8c8e35051a48aa50580f0e2c629aee5fb30bd8e3f21025f75a9b3aa87'
AND (
token = 'R0giWrcgv2Rq4q8XdkztZ97wcFYqL+2zriEnx22/V9s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)