UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cBNozQrWy4mECZd8Mp1GN1hK1DM3LeWu4UluuHT5HB4='
WHERE
key_id = 'bd636cf6b55b28a14386ed68bc9e937eed987e679b33d6d163116d2ef1d40998'
AND (
token = 'cBNozQrWy4mECZd8Mp1GN1hK1DM3LeWu4UluuHT5HB4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)