UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M2CROh0hHAuOslkw+mzVYa+rJF+kTko0mtfkj3G71i8='
WHERE
key_id = '131bf5ff9db0a3ae05a63697bf145ae35c467663d26243008ce6441c3b623122'
AND (
token = 'M2CROh0hHAuOslkw+mzVYa+rJF+kTko0mtfkj3G71i8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)