UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cUH734FOsfXrtI21UUjE2o+Ltd5yt8SW3cyygwuw4Dw='
WHERE
key_id = '01087a58302ef8b7db4cff89f371d7d12c1cc5abb736145776843208b3e044ab'
AND (
token = 'cUH734FOsfXrtI21UUjE2o+Ltd5yt8SW3cyygwuw4Dw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)