UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C9EPGV01zkgCPtQqq5EyySx1wv+eJdJ+f2BHXo5ZX9Y='
WHERE
key_id = 'a2eda449146f8ed289b0e65d75aa7af21ffd3181fc6cf65489979e6cf4276f44'
AND (
token = 'C9EPGV01zkgCPtQqq5EyySx1wv+eJdJ+f2BHXo5ZX9Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)